const express = require('express');
const app = express();

global.task = [];

app.use('/demo',(req,res,next)=>{
    console.log('==demo');
    global.task.push({taskId: global.task.length})
    console.log(global.task)
    setInterval(()=>{
        global.task = global.task.filter((item,i)=> i!==0)
        console.log('======')
        console.log(global.task)

    },3000)
    res.json(global.task)
})
app.listen(3001,()=>{
    console.log('serve is starting!')
})